package com.qf.aop.aspect;

import com.qf.aop.async.AsyncTaskFactory;
import com.qf.aop.config.Ip2regionUtil;
import com.qf.core.thread.ThreadPoolManager;
import com.qf.core.utils.ServletUtils;
import jakarta.servlet.http.HttpServletRequest;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Author: sin
 * @Date: 2025/6/6 22:37
 * @Description:
 **/
@Aspect
@Component
public class AopVisitTimes {

    @Autowired
    private AsyncTaskFactory asyncTaskFactory;

    @Pointcut("execution(public * com.qf..blog.controller..*(..))")
    public void visitorAccess() {}

    @Before("visitorAccess()")
    public void beforeVisitorAccess(JoinPoint joinPoint) {
        // 访问统计等业务逻辑
        ThreadPoolManager.execute(asyncTaskFactory.recordVisitorTime());
    }
}
